import 'package:flutter/material.dart';
import 'package:get/get.dart';

class TextFieldController extends GetxController {
  final TextEditingController textController = TextEditingController();
  final RxString text = ''.obs;

  @override
  void onInit() {
    super.onInit();
    textController.addListener(() {
      text.value = textController.text;
    });
  }

  void clear() {
    textController.clear();
    text.value = '';
  }

  @override
  void onClose() {
    textController.dispose();
    super.onClose();
  }
}
